package com.songcha.sakura.ui.adapter


import android.os.Bundle
import androidx.fragment.app.*
import com.songcha.sakura.mvvm.home.cate.HomeCateFragment


/***
 * 测试
 */
/* class HomeCateAdapter(fa:FragmentActivity,val titles:ArrayList<String>) : FragmentStateAdapter(fa) {

    override fun getItemCount(): Int {
       return titles.size
    }

    override fun createFragment(position: Int): Fragment {
        return HomeCateFragment(titles[position])
    }


}*/



 class HomeCateAdapter2(fm:FragmentManager, val titles:ArrayList<String>) : FragmentStatePagerAdapter(fm) {
     override fun getCount(): Int {
        return titles.size
     }

     override fun getItem(position: Int): Fragment {

             val bundle=Bundle()
             bundle.putInt("index",position+1)
             val frag=HomeCateFragment()
             frag.arguments=bundle
             return frag

     }

     override fun getPageTitle(position: Int): CharSequence? {
         return titles[position]
     }


 }


